home *** CD-ROM | disk | FTP | other *** search
/ Workbench Design / WB Collection.iso / workbench werkzeuge / bildschirmschoner / bserver_v1.5 / sources.lha / Sources / server / askfiles.c next >
C/C++ Source or Header  |  1995-11-08  |  2KB  |  67 lines

  1. #include <utility/tagitem.h>
  2. #include <string.h>
  3. #include <proto/exec.h>
  4. #include <proto/asl.h>
  5. #include <proto/dos.h>
  6.  
  7. #include "/include/server.h"
  8.  
  9. char drawername[77];
  10. char filename[CLIENTNAME_MAXLENGTH];
  11.  
  12. struct TagItem sourcetags[] = {
  13. { ASLFR_TitleText, (ULONG)&"Select clients" },
  14. { ASLFR_InitialDrawer, (ULONG)drawername },
  15. { ASLFR_InitialFile, (ULONG)filename },
  16. { ASLFR_Flags1, FRF_DOMULTISELECT },
  17. { ASLFR_InitialHeight, 210L },
  18. { ASLFR_RejectIcons, TRUE },
  19. { TAG_END, NULL } };
  20.  
  21. extern void AddClient( char *, char *, char * );
  22. extern void DetachGadgets( void );
  23. extern void AttachGadgets( void );
  24.  
  25. struct Library *AslBase;
  26.  
  27. void AskFiles( void )
  28. {
  29. struct FileRequester *request;
  30. UWORD x;
  31. struct WBArg *asl_args;
  32.  
  33. if ( AslBase = OpenLibrary( "asl.library", 0L ) )
  34.     {
  35.     if ( request = (struct FileRequester *)AllocAslRequest( ASL_FileRequest, sourcetags ) )
  36.         {
  37.         strcpy( filename, FilePart(filename) );
  38.         if ( AslRequest( request, sourcetags ) )
  39.             {
  40.             DetachGadgets();
  41.             strcpy( filename, request->fr_Drawer );
  42.             if ( filename[0] )
  43.                 {
  44.                 strcpy( drawername, filename );
  45.                 if ( filename[ strlen(filename)-1 ] != ':' && filename[ strlen(filename)-1 ] != '/' )
  46.                     strcat( filename, "/" );
  47.                 }
  48.  
  49.             asl_args = request->fr_ArgList;
  50.             for ( x = 0; x < request->fr_NumArgs; x++ )
  51.                 {
  52.                 if ( request->fr_Drawer[0] )
  53.                     *(FilePart(filename)) = 0;
  54.                 else
  55.                     filename[0] = 0;
  56.                 strcat( filename, asl_args[x].wa_Name );
  57.                 AddClient( FilePart(filename), filename, NULL );
  58.                 }
  59.  
  60.             AttachGadgets();
  61.             }
  62.         FreeAslRequest( request );
  63.         }
  64.     CloseLibrary( AslBase );
  65.     }
  66. }
  67.